using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WebFoundation.Data;
using MHI.InspectionManager.Interfaces; 

namespace MHI.InspectionManager.Data
{
	/// <summary>
	/// DevMaintenancedetailT,table entity:dev_maintenancedetail_t 
	/// </summary>
	internal class DevMaintenancedetailTWritingDAO : WritableDAO<DevMaintenancedetailT> 
	{
		protected static DbManager _dbManager = DbManager.FromConfig("DefaultConnection");

		public DevMaintenancedetailTWritingDAO()
		: base(_dbManager)
		{
		}

		public DevMaintenancedetailTWritingDAO(DbManager db)
		: base(db)
		{
			_dbManager = db;
		}

		/// <summary>
		/// 增加一行DevMaintenancedetailT,table entity:dev_maintenancedetail_t信息 
		/// </summary>
		/// <returns></returns>
		public bool AddDevMaintenancedetailT(DevMaintenancedetailT item)
		{
			this.Add(item);
			return true;
		}

		/// <summary>
		/// 增加多行DevMaintenancedetailT,table entity:dev_maintenancedetail_t信息 
		/// </summary>
		/// <returns></returns>
		public bool AddDevMaintenancedetailTs(DevMaintenancedetailT[] items)
		{
			this.Add(items);
			return true;
		}

		/// <summary>
		/// 更新一行DevMaintenancedetailT,table entity:dev_maintenancedetail_t信息 
		/// </summary>
		/// <returns></returns>
		public bool UpdateDevMaintenancedetailT(DevMaintenancedetailT item)
		{
			bool bOK = this.Update(item);
			return bOK;
		}

		/// <summary>
		///  更新多行DevMaintenancedetailT,table entity:dev_maintenancedetail_t信息 
		/// </summary>
		/// <returns></returns>
		public bool UpdateDevMaintenancedetailTs(DevMaintenancedetailT[] items)
		{
			bool bOK = this.Update(items);
			return bOK;
		}

		/// <summary>
		/// 删除一行DevMaintenancedetailT,table entity:dev_maintenancedetail_t信息 
		/// </summary>
		/// <returns></returns>
		public bool DeleteDevMaintenancedetailT(DevMaintenancedetailT item)
		{
			bool bOK = this.Delete(item);
			return bOK;
		}

		/// <summary>
		///  删除多行DevMaintenancedetailT,table entity:dev_maintenancedetail_t信息 
		/// </summary>
		/// <returns></returns>
		public bool DeleteDevMaintenancedetailTs(DevMaintenancedetailT[] items)
		{
			bool bOK = this.Delete(items);
			return bOK;
		}

		/// <summary>
		///  根据ids，删除多行DevMaintenancedetailT,table entity:dev_maintenancedetail_t信息 
		/// </summary>
		/// <returns></returns>
		public bool DeleteDevMaintenancedetailTByIds(int[] ids)
		{
			for (int i = 0; i < ids.Length; i++)
			{
				DynamicalBatchExcutor<DevMaintenancedetailT> excutor = new DynamicalBatchExcutor<DevMaintenancedetailT>(this.DBManager);
				excutor.Query().Filter().Eq(r => r.Id, ids[i]);
				excutor.BatchDelete(this.Transaction, _TimeOut);
			}
			return true;
		}

	}
}
